package com.bytecodezz.app.toolset.launcher.model

import androidx.lifecycle.MutableLiveData
import com.bytecodezz.app.framework.base.model.BaseViewModel
import com.bytecodezz.app.framework.better.SingleLiveEvent
import com.bytecodezz.app.toolset.R
import com.bytecodezz.app.toolset.launcher.domain.ToolEntity

/**
 * @author: bytecodezz
 * @version: 1.0
 * @time: 2021/7/7 13:22
 * @package: com.bytecodezz.app.toolset.launcher.model
 *
 * @description:
 *
 */
class LauncherViewModel : BaseViewModel() {
    val closeFragmentEvent = SingleLiveEvent<String>()
    val toolMenusEvent = MutableLiveData<List<ToolEntity>>()
    private val toolMenus = mutableListOf<ToolEntity>()

    fun closeFragmentPager(tag: String) {
        closeFragmentEvent.value = tag
    }

    fun createListData() {
        toolMenus.clear()
        toolMenus.add(
            ToolEntity(
                1,
                "身份证扫描",
                "对身份证进行扫描并提取其中信息",
                iconRes = R.mipmap.tool_id_card_icon
            )
        )
        toolMenus.add(
            ToolEntity(
                2,
                "银行卡扫描",
                "对银行卡进行扫描并提取其中信息",
                iconRes = R.mipmap.tool_bank_card_icon
            )
        )
        toolMenus.add(
            ToolEntity(
                3,
                "二维码扫描",
                "对二维码进行扫描并获取其中的信息",
                iconRes = R.mipmap.tool_qr_code_icon
            )
        )
        toolMenus.add(
            ToolEntity(
                4,
                "条形码扫描",
                "对条形码进行扫描并获取其中的信息",
                iconRes = R.mipmap.tool_bar_code_icon
            )
        )
        toolMenus.add(ToolEntity(5, "计算器", "功能强大的计算器功能", iconRes = R.mipmap.tool_calculator_icon))
        toolMenus.add(
            ToolEntity(
                6,
                "进制转换",
                "对条形码进行扫描并获取其中的信息",
                iconRes = R.mipmap.tool_binary_system_icon
            )
        )
        toolMenusEvent.value = toolMenus
    }
}